package valid_contr
{
	import mx.controls.DateField;

	public class newDateField extends DateField
	{
		public function newDateField()
		{
			super();
			super.editable = true;
		}
		
		override public function set selectedDate(value:Date):void{
			
			
			if((value == null)){
				super.selectedDate = null;
				super.text = '';
			}
			else
			{
				super.selectedDate = value;
				if (super.selectableRange.rangeEnd != null){
				if (value>((super.selectableRange.rangeEnd) as Date)){
					super.selectedDate = ((super.selectableRange.rangeEnd) as Date);
				}
				}
				if (super.selectableRange.rangeStart != null){
				if (value<((super.selectableRange.rangeStart) as Date)){
					super.selectedDate = ((super.selectableRange.rangeStart) as Date);
				}
				}
			}
			
		}
		
	}
}